home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWWTokenizer.z / RWWTokenizer
Encoding:
Text File  |  1998-10-30  |  3.9 KB  |  133 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWWWWWTTTTooookkkkeeeennnniiiizzzzeeeerrrr((((3333CCCC++++++++))))                                          RRRRWWWWWWWWTTTTooookkkkeeeennnniiiizzzzeeeerrrr((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWWTokenizer - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include <rw/wtoken.h>
  13.  
  14.  
  15.  
  16.               RWWString str("a string of tokens", RWWString::ascii);
  17.           RWWTokenizer(str);  // Lex the above string
  18.  
  19.  
  20.  
  21.  
  22. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  23.      Class RRRRWWWWWWWWTTTTooookkkkeeeennnniiiizzzzeeeerrrr is designed to break a string up into separate tokens,
  24.      delimited by arbitrary "white space."  It can be thought of as an
  25.      iterator for strings and as an alternative to the C library function
  26.      wwwwssssttttooookkkk(((()))) which has the unfortunate side effect of changing the string
  27.      being tokenized.
  28.  
  29. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  30.      None
  31.  
  32. EEEExxxxaaaammmmpppplllleeee
  33.               #include <rw/wtoken.h>
  34.           #include <rw/rstream.h>
  35.           main(){
  36.             RWWString a(L"Something is rotten in the state of Denmark");
  37.             RWWTokenizer next(a);   // Tokenize the string a
  38.             RWWString token;        // Will receive each token
  39.             // Advance until the null string is returned:
  40.             while (!(token=next()).isNull())
  41.               cout << token << "0;
  42.           }
  43.  
  44.  
  45.      PPPPrrrrooooggggrrrraaaammmm oooouuuuttttppppuuuutttt::::
  46.  
  47.                    Something
  48.                is
  49.                rotten
  50.                in
  51.                the
  52.                state
  53.                of
  54.                Denmark
  55.  
  56. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
  57.               RWWTokenizer(const RWWString& s);
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWWWWWTTTTooookkkkeeeennnniiiizzzzeeeerrrr((((3333CCCC++++++++))))                                          RRRRWWWWWWWWTTTTooookkkkeeeennnniiiizzzzeeeerrrr((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.      Construct a tokenizer to lex the string ssss.
  75.  
  76. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnn
  77.               RWWSubString
  78.           ooooppppeeeerrrraaaattttoooorrrr(((())));
  79.  
  80.  
  81.      Advance to the next token and return it as a substring.  The tokens are
  82.      delimited by any of the four wide characters in LLLL"""" 0000. (space, tab,
  83.      newline and null).
  84.  
  85.               RWWSubString
  86.           ooooppppeeeerrrraaaattttoooorrrr(((())))(const wchar_t* s);
  87.  
  88.  
  89.      Advance to the next token and return it as a widesubstring.  The tokens
  90.      are  delimited by any wide character in ssss, or any embedded wide null.
  91.  
  92.               RWWSubString
  93.           ooooppppeeeerrrraaaattttoooorrrr(((())))(const wchar_t* s,size_t num);
  94.  
  95.  
  96.      Advance to the next token and return it as a substring.  The tokens are
  97.      delimited by any of the first nnnnuuuummmm wide characters in ssss....  Buffer ssss may
  98.      contain embedded nulls, and must contain at least nnnnuuuummmm wide characters.
  99.      Tokens will not be delimited by nulls unless ssss contains nulls.
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.